<template>
  <div class="youji">
    <Head
      :school="imgdata"
      title="游记正文"
      xs="1"
      fh="1"
      icon=""
      bgcolor="1"
    />
    <div class="cont">
      <div class="cont-top">
        <div>
          <img :src="school.imgurl" alt="" />
          <div>
            <span>{{ school.title }}</span>
            <span>2021-10-30 12:00</span>
          </div>
        </div>
        <p>
          {{ school.content }}
        </p>
        <div>
          <img :src="school.url" alt="" />
          <img :src="school.url" alt="" />
        </div>
        <div>
          <span class="el-icon-view">140</span>
          <span class="el-icon-chat-dot-round">22</span>
          <span
            @click.stop="qiehuan()"
            :class="{ sc: school.state == 1 }"
            class="el-icon-star-off"
            >12</span
          >
        </div>
      </div>
      <div class="plq">
        <div>
          <div></div>
          <span>评论</span>
        </div>
        <div>
          <div>
            <div>
              <div>
                <img @click.stop="qie" :src="school.url" alt="" />
                <div>
                  <span>Gfjie Hjfi</span>
                  <span>2021-10-30 12:00</span>
                </div>
              </div>
              <div>
                <span>回复</span>
              </div>
            </div>
            <div>我爱旅游啊哈哈哈哈，这个地方好好玩啊</div>
          </div>
          <div>
            <div>
              <img @click.stop="qie" :src="school.url" alt="" />
              <span>Gfjie Hjfi:</span>
              <span>这个地方好好玩啊</span>
            </div>
            <div>
              <img @click.stop="qie" :src="school.url" alt="" />
              <span>Gfjie Hjfi:</span>
              <span>这个地方好好玩啊</span>
            </div>
          </div>
          <div>
            <div>
              <div>
                <img @click.stop="qie" :src="school.url" alt="" />
                <div>
                  <span>Gfjie Hjfi</span>
                  <span>2021-10-30 12:00</span>
                </div>
              </div>
              <div>
                <span>回复</span>
              </div>
            </div>
            <div>我爱旅游啊哈哈哈哈，这个地方好好玩啊</div>
          </div>
          <div>
            <div>
              <img @click.stop="qie" :src="school.url" alt="" />
              <span>Gfjie Hjfi:</span>
              <span>这个地方好好玩啊</span>
            </div>
            <div>
              <img @click.stop="qie" :src="school.url" alt="" />
              <span>Gfjie Hjfi:</span>
              <span>这个地方好好玩啊</span>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="foot">
      <div>
        <input type="text" />
      </div>
      <div>
        <span>发布</span>
      </div>
    </div>
  </div>
</template>

<script>
import Head from "../../components/Fb_body/Head.vue";
export default {
  name: "youji",
  components: {
    Head,
  },
  data() {
    return {
      school: [],
      flag: true,
    };
  },
  methods: {
    qiehuan() {
      if (this.flag) {
        this.flag = false;
        this.school.state = !this.school.state;
        this.ajax({
          method: "post",
          url: "/updateSta",
          data: {
            id: this.school.id,
            state: this.school.state,
          },
        }).then((res) => {
          this.flag = true;
          console.log(res);
        });
      }
    },
    qie(){
        this.$router.push("/Geren")
    }
  },
  mounted() {
    if (this.$store.state.id == 0) {
      alert("数据不能为空");
      this.$router.push({ name: "Home2" });
    }
    this.ajax({
      method: "post",
      url: "/queryAll",
      data: {
        id: this.$store.state.id,
      },
    }).then((res) => {
      this.school = res.data[0];
      console.log(this.school);
    });
  },
};
</script>

<style lang="scss" scoped>
.sc {
  color: orange;
}
.cont {
  // padding: 60px;
//   padding-bottom: 20px;
  overflow: scroll;
  height: 775px;
  > .cont-top {
    width: 90%;
    // height: 400px;
    margin: auto;
    margin-top: 10px;
    border-radius: 10px;
    padding: 10px;
    background-color: #fff;
    > div:nth-of-type(1) {
      display: flex;
      align-items: center;
      > img {
        width: 50px;
        height: 50px;
        border-radius: 50%;
      }
      > div {
        margin-left: 10px;
        display: flex;
        flex-direction: column;
      }
    }
    > div:nth-of-type(2) {
      margin-top: 10px;
      display: flex;
      justify-content: space-around;
      > img {
        width: 170px;
      }
    }
    > div:nth-of-type(3) {
      margin: 10px 0;
      color: gray;
      > span {
        margin-right: 20px;
      }
    }
    > p {
      margin-top: 10px;
      text-indent: 2em;
      color: rgb(83, 83, 83);
    }
  }
  > .plq {
    width: 90%;
    margin: auto;
    padding: 10px;
    margin-top: 20px;
    border-radius: 10px;
    background-color: white;
    > div:nth-of-type(1) {
      width: 100%;
      display: flex;
      > div {
        width: 3px;
        height: 15px;
        background-color: rgb(94, 165, 245);
      }
      > span {
        margin-left: 5px;
      }
    }
    > div:nth-of-type(2) {
      > div:nth-of-type(odd) {
        margin-top: 10px;
        > div {
          display: flex;
          justify-content: space-between;
          &:nth-of-type(2) {
            font-size: 15px;
            margin-left: 60px;
          }
          > div {
            display: flex;
            align-items: center;
            > span {
              color: rgb(84, 177, 240);
            }
            > img {
              width: 50px;
              border-radius: 50%;
            }
            > div {
              margin-left: 10px;
              display: flex;
              flex-direction: column;
              > span:nth-of-type(2) {
                font-size: 14px;
                color: gray;
                margin-top: 5px;
              }
            }
          }
        }
      }
      > div:nth-of-type(even) {
        > div {
          margin-top: 10px;
          display: flex;
          align-items: center;
          justify-content: center;
          > img {
            width: 35px;
            border-radius: 50%;
            margin-right: 10px;
          }
        }
      }
    }
  }
}
.youji {
  background-color: rgb(228, 228, 228);
  padding-bottom: 10px;
}
.foot {
  width: 100%;
  position: fixed;
  bottom: 0;
  left: 0;
  display: flex;
  justify-content: space-between;
  > div {
    &:nth-of-type(1) {
      // width: ;
      height: 60px;
      box-sizing: border-box;
      background-color: rgb(250, 250, 250);
      width: 76%;
      padding-left: 20px;
      //   line-height: 60px;
      overflow: hidden;
      //   display: flex;
      //   align-items: center;
      > input {
        //   margin-top: 20px;
        height: 20px;
        //   line-height: 60px;
        width: 90%;
        //   height: 40px;
        background-color: rgba(0, 0, 0, 0);
        border: none;
        outline: none;
        //   line-height: 60px;
        box-sizing: border-box;
      }
    }
    &:nth-of-type(2) {
      width: 24%;
      height: 60px;
      text-align: center;
      line-height: 60px;
      font-size: 18px;
      background-color: #81acec;
    }
    > span {
      color: white;
    }
  }
}
</style>